
#blkx=( 20 10 20 10 40 20 40 80 80  160 160 320 320 640 640 960 960  1920)
#blky=( 20 40 40 80 40 80 80 80 160 160 320 320 640 640 960 960 1920 1920)
#sblkx=(20 10 20 10 40 20 40 80 80  80  80  80  80  80  80  80  80   80)
#sblky=(20 40 40 80 40 80 80 80 80  80  80  80  80  80  80  80  80   80)
blkx=( 10 10 20 40 80 80  160 160 320 320 640 960  1280)
blky=( 40 80 80 80 80 160 160 320 320 640 640 1280 1920)
sblkx=(10 10 20 40 80 80  80  80  80  80  80  80   80)
sblky=(40 80 80 80 80 80  80  80  80  80  80  80   80)

file=temp.log
result_file=result.log

rm $file $result_file 

for((i=0;i<=12;i++))
do
  sed s/@BLKX/${blkx[$i]}/g makefile_temp > temp
  sed s/@BLKY/${blky[$i]}/g temp > temp2
  sed s/@SBLKX/${sblkx[$i]}/g temp2 > temp
  sed s/@SBLKY/${sblky[$i]}/g temp > makefile_test_$i
#  sed s/#test[$i]#//g makefile_temp > makefile_test_$i
  cp -f makefile_test_$i makefile
  make clean
  make dag
  echo ${blk[$i]}
  bsub -I -b -q q_sw_expr -n 1 -cgsp 64 -host_stack 1024 -share_size 6000 -o $file ./gauss_dag 0 0 50 64

done

rm temp temp2

echo total_graph_build >> $result_file
grep -n "total_graph_build" $file | awk {'print $2'} >> $result_file

echo total_graph_exec >> $result_file
grep -n "total_graph_exec" $file | awk {'print $2'} >> $result_file

echo total_time >> $result_file
grep -n "total_time" $file | awk {'print $2'} >> $result_file

echo mutex_file >> $result_file 
grep -n "ain core mutex fa" ./$file | awk '{print $6}' >> $result_file
echo total_mutex >> $result_file
grep -n "re mutex success co" ./$file| awk '{print $6}' >> $result_file


cat $result_file

mv $file $1_$file
mv $result_file $1_${result_file}
